package path;

/**
 * 二、路径问题
 * 3. 礼物的最大价值
 * 2024-10-19
 */
public class demo7 {
    public int jewelleryValue(int[][] frame) {
        //1. 创建 dp 表
        int m = frame.length;
        int n = frame[0].length;
        int[][] dp = new int[m+1][n+1];

        //2. 初始化
        //3. 填表
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]) + frame[i-1][j-1];
        return dp[m][n];
    }
}
